<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                    template="./AdminTemplate.xhtml">
        <ui:define name="Title">
            <title>Order</title>
        </ui:define>
        <ui:define name="content">
            <h:form>
                <div id="content" style="font-size: 0.8em">
                    <p:dataTable  rendered="#{adminVihicleBean.emp.position==1}" id="datatable" value="#{adminVihicleBean.listOrder}" var="order"  widgetVar="vehicleTable"
                                  emptyMessage="No cars found with given criteria">
                        <f:facet name="header">
                            <p:outputPanel>
                                <!--                                <h:outputText value="Search all fields : " />
                                                                <p:inputText id="globalFilter" onkeyup="vehicleTable.filter()" style="width:100px" />-->
                                Form : <p:calendar value="#{adminVihicleBean.datetimeform}"  navigator="true" pattern="yyyy-MM-dd"  id="trCalform">
                                </p:calendar>
                                To : <p:calendar value="#{adminVihicleBean.datetimeto}" navigator="true" pattern="yyyy-MM-dd" id="trCalto"/>
                                <h:commandButton value="Search" action="#{adminVihicleBean.searchOrderbydatetime}"/>
                                <h:commandButton value="Reset" action="#{adminVihicleBean.resetsearch}"/>
                                <h:commandButton  style="float: right" value="Add Order" action="#{adminVihicleBean.addOrder}"/>
                                <!--                                <h:selectBooleanCheckbox value="Payment"  onclick="this.form.submit()" valueChangeListener="{adminVihicleBean.paymentandpail}" />Payment-->
                            </p:outputPanel>

                        </f:facet>
                        <p:column id="fullnameColumn" filterBy="#{order.cusFullName}" headerText="Full Name">

                            <h:outputText value="#{order.cusFullName}"/>
                        </p:column>

                        <p:column id="priceColumn" filterBy="#{order.price}" headerText="Price">
                            <h:outputText value="#{order.price}"/>
                        </p:column>
                        <p:column id="dateRegisColumn" filterBy="#{order.dateRegis}" headerText="DateRegis">
                            <h:outputText value="#{order.dateRegis}"/>
                        </p:column>
                        <p:column id="vehicleIDColumn" headerText="Vehicle ID">
                            <h:outputText value="#{order.vehicleID}"/>
                        </p:column>
                        <p:column id="statusColumn">
                            <f:facet name="header">
                                <h:outputText value="Status"/><br/>
                                <h:selectBooleanCheckbox value="Payment"  onclick="this.form.submit()" valueChangeListener="#{adminVihicleBean.paymentandpail}" />Payment
                            </f:facet>
                            <!--  <h:commandButton style="font-size: 0.9em;width: 70px;height: 30px" disabled="{adminVihicleBean.paymentandpailcheckbook}" action="{adminVihicleBean.updatePayment(order)}" value="{order.button}"/>-->
                            <h:commandLink style="color: blue;font-size: 0.9em;width: 70px;height: 30px"  action="#{adminVihicleBean.updatePayment(order)}" value="#{order.button}"/>
                        </p:column>
                        <p:column id="deleteColumn" headerText="Delete">
                            <h:commandLink id="delete" action="#{adminVihicleBean.deleteOrder(order)}" >
                                <p:graphicImage value="./images/delete-red2.png" style="width: 30px; height: 30px" />
                            </h:commandLink>
                        </p:column>
                        <f:facet name="footer">
                            <p:outputPanel style="float: right;" >
                                <h:commandButton  value="Add Order" action="#{adminVihicleBean.addOrder}"/>
                            </p:outputPanel>
                        </f:facet>
                    </p:dataTable>
                    <p:panel id="p1" rendered="#{adminVihicleBean.emp.position!=1}" header="Sorry" footer="sorry">
                        Sorry Ban khong co quyen vao trang nay
                    </p:panel>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
